package com.dbuil.bleshoes.adapter;

import android.widget.RelativeLayout;

import com.blankj.utilcode.util.ConvertUtils;
import com.blankj.utilcode.util.ScreenUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dbuil.bleshoes.R;
import com.dbuil.bleshoes.bean.ProductListBean;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class ProductListAdapter extends BaseQuickAdapter<ProductListBean, BaseViewHolder> implements LoadMoreModule {

    public ProductListAdapter(@Nullable List<ProductListBean> data) {
        super(R.layout.item_product, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, ProductListBean productListBean) {
        //设置图片背景的高度和宽度相同
        RelativeLayout rlProduct = baseViewHolder.findView(R.id.rl_product_root);
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) rlProduct.getLayoutParams();
        layoutParams.height = (ScreenUtils.getScreenWidth() - ConvertUtils.dp2px(35)) / 2;
        rlProduct.setLayoutParams(layoutParams);



    }
}
